<template>
	<view class="page" v-if="showLoading">
		<!-- <view class="top">
			<view class="logo">
				<image src="/static/images/logo.png"></image>
			</view>
			<view class="title">AI帮你拍写真</view>
		</view> -->
		<image :src="`${util.imageUrl}launchPage.jpg`" class="bg"></image>
		<view class="loading ">
			<!--  :duration="1000" -->
			<progress class="launchPage" :percent="percent" border-radius="20" activeColor="#81FFFA"
				backgroundColor="#004572" :active="true" active-mode="forwards" @activeend="activeendFn"></progress>
			<view class="text">正在加载，请稍后…</view>
		</view>

	</view>
</template>

<script>
	import util from "@/utils/util.js"
	export default {
		name: "launchPage",
		props: {
			showLoading: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				percent: 0,
				util
			};
		},
		mounted() {

			let time = setInterval((res) => {
				this.percent += 5;
				if (this.percent >= 100) {
					clearInterval(time);
				}
			}, 100)
		},
		methods: {
			activeendFn() {
				this.$emit("loadingSuccess")
			}

		}
	}
</script>

<style lang="scss" scoped>

	.page {
		background:#fff;
		// background-image: url('');
		background-repeat: no-repeat;
		background-size: cover;
		width: 100vw;
		height: 100vh;
		position: fixed;
		top: 0;
		z-index: 1000;
		.bg{
			width:100vw;
			height:100vh;
			position: absolute;
			top:0;
		}
		.top {
			position: relative;
			top: 30%;
			left: 50%;
			transform: translateX(-50%);
			text-align: center;

			.logo {
				position: relative;
				width: 175rpx;
				height: 175rpx;
				margin: 0 auto 30rpx;

				&::after {
					content: "";
					width: 147rpx;
					height: 40rpx;
					background-image: linear-gradient(to bottom, rgba(255, 193, 0, 0), rgba(255, 193, 0, 1));
					filter: blur(5px);
					position: absolute;
					bottom: -10rpx;
					left: 50%;
					transform: translateX(-50%);
					border-radius: 100rpx;

				}
			}

			.title {
				font-size: 43rpx;
				font-weight: 900;
			}

			image {
				width: 100%;
				height: 100%;
				border-radius: 28rpx;


			}
		}

		.loading {
			position: absolute;
			width: 502rpx;
			bottom: 122rpx;
			left: 50%;
			transform: translateX(-50%);

			.text {
				font-size: 24rpx;
				color: #fff;
				font-weight: 900;
				text-align: center;
				margin-top: 20rpx;
			}
		}
	}
</style>